<template>
  <div class="updateBox">
    <Edit
      title="The latest update"
      :updataArr="updataArr"
      :tabs="true"
      :conutNum="conutNum"
      @handleSizeChange="handleSizeChange"
    />
  </div>
</template>

<script>
import Edit from "../../components/HistoryChild/Edit.vue";
import { RankingsApi } from "../../requery/api";
export default {
  data() {
    return {
      updataArr: [],
      conutNum: null,
    };
  },
  methods: {
    // 点击分页
    handleSizeChange(val) {
      RankingsApi({
        page: val,
        size: 12,
        order_by: "update_tme",
      }).then((res) => {
        if (res.code == 200) {
          this.updataArr = res.data;
          this.conutNum = res.count;
        }
        console.log(res);
      });
    },
  },
  created() {
    RankingsApi({
      page: 1,
      size: 12,
      order_by: "update_tme",
    }).then((res) => {
      if (res.code == 200) {
        this.updataArr = res.data;
        this.conutNum = res.count;
      }
      console.log(res);
    });
  },
  components: {
    Edit,
  },
};
</script>
 
<style lang = "less" scoped>
.updateBox {
  width: 100vw;
  .budateBox_center {
    width: 1160px;
    margin: 0 auto;
    padding-top: 45px;
    box-sizing: border-box;
    .update_navbas {
      width: 100%;
      height: 41px;
      font-weight: 500;
      display: flex;
      align-items: center;
      /deep/.el-tabs {
        margin-left: 58px;
        color: #fff;
      }
      /deep/.el-tabs__header {
        margin: 0;
      }
      /deep/.el-tabs__item {
        color: #333333;
      }
      /deep/.el-tabs__item.is-active {
        color: #fb6e3b !important;
        opacity: 1 !important;
      }
      /deep/.el-tabs__nav-wrap::after {
        background-color: #fff;
      }
      /deep/.el-tabs__active-bar {
        /* margin: 0 auto !important;
        width: 20px !important; */
        background-color: #fb6e3b !important;
        opacity: 1 !important;
      }
      .title {
        font-size: 26px;
        font-weight: 500;
        color: #333333;
      }
    }
    .updateHear {
      display: flex;
      flex-wrap: wrap;
      margin-top: 40px;
      width: 1200px;
      position: relative;
      .goto {
        width: 46px;
        height: 114px;
      }
      .leftbtn {
        position: absolute;
        left: 0;
        top: 300px;
      }
      .rightbtn {
        position: absolute;
        right: 0;
        top: 300px;
      }
      .updatebook:nth-child(6n) {
        margin-right: 0;
      }
      .updatebook {
        width: 191px;
        font-weight: 500;
        margin-bottom: 58px;
        margin-right: 10px;
        img {
          width: 191px;
          height: 256px;
        }
        .bookname {
          font-size: 15px;
          color: #333333;
          margin: 16px 0 13px;
        }
        .newest {
          font-size: 14px;
          color: #999999;
        }
      }
    }
  }
}
</style>